﻿using DataAccess;
using System.Data;

namespace SkynetMSSQLAccess
{
    /// <summary>
    /// DbTypeEnum 的摘要说明。
    /// </summary>
    public class DbTypeEnum : IDbTypeEnum
    {

        public int GetTypeEnum(string dbType)
        {
            switch (dbType.Trim().ToUpper())
            {
                case "BIT":
                    return SqlDbType.Bit.GetHashCode();
                case "BINARY":
                    return SqlDbType.Binary.GetHashCode();
                case "BIGINT":
                    return SqlDbType.BigInt.GetHashCode();
                case "CHAR":
                    return SqlDbType.Char.GetHashCode();
                case "DATETIME":
                    return SqlDbType.DateTime.GetHashCode();
                case "DECIMAL":
                    return SqlDbType.Decimal.GetHashCode();
                case "FLOAT":
                    return SqlDbType.Float.GetHashCode();
                case "IMAGE":
                    return SqlDbType.Image.GetHashCode();
                case "INT":
                    return SqlDbType.Int.GetHashCode();
                case "MONEY":
                    return SqlDbType.Money.GetHashCode();
                case "TEXT":
                    return SqlDbType.Text.GetHashCode();
                case "TIMESTAMP":
                    return SqlDbType.Timestamp.GetHashCode();
                case "VARCHAR":
                case "STRING":
                    return SqlDbType.VarChar.GetHashCode();
                case "NVARCHAR":
                    return SqlDbType.NVarChar.GetHashCode();

            }
            return 0;
        }
    }
}
